#ifndef BUTTONSLIDER_H
#define BUTTONSLIDER_H

#include "EventPoller.h"
#include "EventHandler.h"
#include "Text.h"
#include "Sound.h"

#include <D3D10_1.h>
#include <D3DX10.h>
#include <string>

class ButtonSlider : public EventHandler
{
public:
	ButtonSlider();
	virtual ~ButtonSlider() = 0;
	virtual void Draw();
	virtual void Update() = 0;

	void SetPos(const D3DXVECTOR2& pos);
	void SetSound(Sound* s);

	float GetAmount() const;
	
	virtual void OnMouseMotionEvent(const LPARAM& event) override;
	virtual void OnMouseButtonDownEvent(const MSG& event) override;
	virtual void OnMouseButtonUpEvent(const MSG& event) override;
private:
	void IntersectedMouse();
protected:
	D3DXVECTOR3 m_pos; // bg
	D3DXVECTOR3 m_size; // bg
	D3DXVECTOR3 m_posSlider; // slider
	D3DXVECTOR3 m_sizeSlider; // slider
	D3DXVECTOR3 m_sizeSliderOrig; // slider
	D3DXVECTOR4 m_colSlider;

	D3DXVECTOR2 m_mouseDownPos;
	D3DXVECTOR2 m_convertedMousePos;
	D3DXVECTOR2 m_mousePos;
	D3DXVECTOR2 m_screenSize;

	float m_mouseDelta;
	float m_oldMouseX;

	float m_outlineSize;

	bool m_mouseMoved;
	bool m_mouseDown;
	bool m_mouseIntersected;
	bool m_mouseButtonWasReleased;
	bool m_mouseDidIntersect;

	float m_aspectRat;

	float m_amount; // how far the bar is, range 0-1
	Text m_text;
	float m_textSize;
	std::string m_name;

	Sound* m_sound;
};

#endif //BUTTONSLIDER_H